package com.ilink.groundservice.mapper.Literature;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ilink.groundservice.entity.PO.Literature.AiXLiterature;
import com.ilink.groundservice.entity.VO.AiX.AiXLiteratureResponse;
import com.ilink.ilinkapi.dto.ground.AiX.AiXLiteratureFilterRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AiXLiteratureMapper extends BaseMapper<AiXLiterature> {

    /**
     * 分页查询文献列表
     */
    IPage<AiXLiteratureResponse> selectLiteraturePage(Page<AiXLiteratureResponse> page, @Param("request") AiXLiteratureFilterRequest request, @Param("userId") String userId);

    /**
     * 分页查询文献列表(使用标签筛选)
     */
    IPage<AiXLiteratureResponse> selectLiteraturePageByTag(Page<AiXLiteratureResponse> page, @Param("request") AiXLiteratureFilterRequest request, @Param("userId") String userId);

    /**
     * 根据ID查询文献详情
     */
    AiXLiteratureResponse selectLiteratureById(@Param("literatureId") Long literatureId, @Param("userId") String userId);

    /**
     * 获取推荐文献
     */
    List<AiXLiteratureResponse> selectRecommendedLiteratures(@Param("limit") Integer limit, @Param("userId") String userId);

    /**
     * 获取热门文献
     */
    List<AiXLiteratureResponse> selectPopularLiteratures(@Param("limit") Integer limit, @Param("userId") String userId);

    /**
     * 搜索文献
     */
    IPage<AiXLiteratureResponse> searchLiteratures(Page<AiXLiteratureResponse> page, @Param("query") String query, @Param("searchType") String searchType, @Param("userId") String userId);

    /**
     * 增加查看次数
     */
    int incrementViewCount(@Param("literatureId") Long literatureId);

    /**
     * 增加下载次数
     */
    int incrementDownloadCount(@Param("literatureId") Long literatureId);

    /**
     * 获取单个文献的标签列表
     */
    List<String> selectLiteratureTags(@Param("literatureId") Long literatureId);
} 